<%@ page contentType="text/html; charset=utf-8" import="java.util.HashMap;" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:if test="${!empty(requestScope.menus)}">
<select name="parents" onchange="getChildMenu('container',this)">
	<option value="0">无</option>
	<c:forEach items="${requestScope.menus}" var="item">
	<c:set var="menu" value="${item.value}"/>
	<c:if test="${menu.isdir eq 1}">
	<option value="${item.key}">${menu.menu_name}</option>
	</c:if>
	</c:forEach>
</select>
</c:if>

<script type="text/javascript">
$('#groups').html('');
<c:choose>
	<c:when test="${requestScope.pid eq 0 || (requestScope.pid gt 0 && null eq requestScope.groupids)}">
$('#groups').append('<p style="width:100%;height:20px;border-bottom:dashed 1px blue;padding-bottom:5px;margin-bottom:5px;"><input type="checkbox" name="open" value="1"<c:if test="${requestScope.pid gt 0 && null eq requestScope.groupids}"> checked</c:if> style="vertical-align:middle;"/><span style="line-height:20px;padding-left:2px;">不限</span><span style="color:red;">[勾选此处后虚线下方的选项将被忽略]</span></p>');
$('#groups').append('<span style="color:green;padding-right:4px;">超级管理员</span>');
<c:forEach items="${requestScope.groups}" var="group">
<c:if test="${group.key ne 1}">
$('#groups').append('<input type="checkbox" name="groups" value="${group.key}" style="vertical-align:middle;"/><span style="color:blue;padding-left:4px;">${group.value}</span>');
</c:if>
</c:forEach>
	</c:when>
	<c:otherwise>
$('#groups').append('<span style="color:green;padding-right:4px;">超级管理员</span>');
	<c:forEach items="${requestScope.groupids}" var="id">
		<c:set var="groupid" value="${id}" scope="request"/>
		<c:if test="${id ne 1}">
$('#groups').append('<input type="checkbox" name="groups" value="${id}" checked style="vertical-align:middle;"><span style="padding-left:4px;color:blue;"><%
//用以实现${requestScope.groups[id]},因为方括号内数字需要为long型，而id为整形，所以需要用jsp实现
Integer groupid = Integer.valueOf((String)request.getAttribute("groupid"));
HashMap<Integer, String> groups = (HashMap<Integer, String>)request.getAttribute("groups");
out.print(groups.get(groupid));
%></span>');
		</c:if>
	</c:forEach>
	</c:otherwise>
</c:choose>
</script>